﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using DataService;
using DTO;

public partial class Admin_login : BasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if ( !IsPostBack && AdminLogin != null)
        {
            Response.Redirect("~/admin/default.aspx");
        }
    }

    protected void btnSignIn_Click(object sender, EventArgs e)
    {
        AdminService service = new AdminService();
        AdminLogin = service.Login(txtUserName.Value, txtPassword.Value);

        if ( AdminLogin != null )
        {
            Response.Redirect("~/admin/Default.aspx");
        }
        else
        {
            lblMessage.Text = "Invalid credentials. Please try again.";
        }
    }
}